package org.mch.func.str.cut;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;

import org.mch.biz.ui.BizEvent;
import org.mch.biz.ui.BizPanel;
import org.mch.swingm.core.MButton;
import org.mch.swingm.ext.METextField;
import javax.swing.JTabbedPane;
import java.awt.Font;

/**
 * 描述：字符串截取；<BR/>
 * 
 * @author mch
 * 
 */
public class ClientPanel extends BizPanel {
	private static final long serialVersionUID = 1L;
	private JSplitPane splitPane;
	private JPanel panel;
	private JPanel panel_1;
	private MButton btn_execute_cutindex;
	private METextField text_cutindex;
	private JTabbedPane tabbedPane;
	private JPanel panel_2;
	private JPanel panel_3;
	private JScrollPane scrollPane;
	private JTextArea text_newstr;
	private JScrollPane scrollPane_1;
	private JTextArea text_srcstr;

	public ClientPanel() {
		initComponents();
	}

	private void initComponents() {
		setLayout(new BorderLayout(0, 0));
		add(getSplitPane(), BorderLayout.CENTER);
	}

	protected BizEvent createEvent() {
		return new ClientEvent(this);
	}

	public JSplitPane getSplitPane() {
		if (splitPane == null) {
			splitPane = new JSplitPane();
			splitPane.setDividerSize(3);
			splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
			splitPane.setLeftComponent(getPanel_1());
			splitPane.setRightComponent(getPanel_1_1());
			splitPane.setDividerLocation(200);
		}
		return splitPane;
	}

	public JPanel getPanel_1() {
		if (panel == null) {
			panel = new JPanel();
			panel.setLayout(null);
			panel.add(getBtn_execute_cutindex());
			panel.add(getText_cutindex());
		}
		return panel;
	}

	public JPanel getPanel_1_1() {
		if (panel_1 == null) {
			panel_1 = new JPanel();
			panel_1.setLayout(new BorderLayout(0, 0));
			panel_1.add(getTabbedPane(), BorderLayout.CENTER);
		}
		return panel_1;
	}

	public MButton getBtn_execute_cutindex() {
		if (btn_execute_cutindex == null) {
			btn_execute_cutindex = new MButton("执行");
			btn_execute_cutindex.setBounds(497, 10, 93, 25);
			btn_execute_cutindex.addMouseListener(getEvent());
		}
		return btn_execute_cutindex;
	}

	public METextField getText_cutindex() {
		if (text_cutindex == null) {
			text_cutindex = new METextField("从此字符串开始截取至最后：");
			text_cutindex.setBounds(10, 10, 477, 25);
		}
		return text_cutindex;
	}
	public JTabbedPane getTabbedPane() {
		if (tabbedPane == null) {
			tabbedPane = new JTabbedPane(JTabbedPane.TOP);
			tabbedPane.setFont(new Font("宋体", Font.BOLD, 13));
			tabbedPane.addTab("源字符串", null, getPanel_2(), null);
			tabbedPane.addTab("新字符串", null, getPanel_3(), null);
		}
		return tabbedPane;
	}
	public JPanel getPanel_2() {
		if (panel_2 == null) {
			panel_2 = new JPanel();
			panel_2.setLayout(new BorderLayout(0, 0));
			panel_2.add(getScrollPane_1(), BorderLayout.CENTER);
		}
		return panel_2;
	}
	public JPanel getPanel_3() {
		if (panel_3 == null) {
			panel_3 = new JPanel();
			panel_3.setLayout(new BorderLayout(0, 0));
			panel_3.add(getScrollPane(), BorderLayout.CENTER);
		}
		return panel_3;
	}
	public JScrollPane getScrollPane() {
		if (scrollPane == null) {
			scrollPane = new JScrollPane();
			scrollPane.setViewportView(getText_newstr());
		}
		return scrollPane;
	}
	public JTextArea getText_newstr() {
		if (text_newstr == null) {
			text_newstr = new JTextArea();
		}
		return text_newstr;
	}
	public JScrollPane getScrollPane_1() {
		if (scrollPane_1 == null) {
			scrollPane_1 = new JScrollPane();
			scrollPane_1.setViewportView(getText_srcstr());
		}
		return scrollPane_1;
	}
	public JTextArea getText_srcstr() {
		if (text_srcstr == null) {
			text_srcstr = new JTextArea();
		}
		return text_srcstr;
	}
}